import React from 'react'
import PropTypes from 'prop-types'
import classNames from 'classnames'
export default function Icon(props) {
  // 父组件必须要提供type和classname属性
  const { type, className, ...rest } = props
  return (
    <svg className={classNames('icon', className)} aria-hidden="true" {...rest}>
      <use xlinkHref={`#${type}`}></use>
    </svg>
  )
}
// props验证
Icon.propTypes = {
  type: PropTypes.string.isRequired,
}
